/*
 * FrontPage.fx
 *
 * Created on Feb 23, 2010, 7:57:40 PM
 */
package com.gpsbuddy.navigation;

import javafx.scene.Scene;
import com.gpsbuddy.components.MainBackground;
import com.gpsbuddy.navigation.components.FrontNavigationBar;
import javafx.animation.Interpolator;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import com.gpsbuddy.main.Enviroment;
import javafx.scene.Group;

/**
 * @author jonycus
 */
public class FrontPage extends Scene {

    public-init var env: Enviroment;
    var mainBg = MainBackground { }
    var mainNavigation = FrontNavigationBar {
                layoutX: 20;
                layoutY: 20;
            }
    var mainNavigationBar = MainStatusBar {
                env: env;
                width: bind env.screenWidth;
                height: bind env.screenHeight;
                barHeight: 30
            }
    var op: Number = 1.0;
    var lX: Number = 0;
    var group = Group {
                opacity: bind op;
                layoutX: bind lX;
                content: [mainBg, mainNavigation, mainNavigationBar]
            }

    postinit {
        content = [group];
    }

    public function transitIn() {
        Timeline {
            keyFrames: [
                KeyFrame {
                    time: 0s
                    values: [lX => -env.screenWidth tween Interpolator.LINEAR, op => 0.0 tween Interpolator.LINEAR];
                }
                KeyFrame {
                    time: 0.5s
                    values: [lX => 0 tween Interpolator.LINEAR, op => 1.0 tween Interpolator.LINEAR];
                }
            ]
        }.play();
    }

}
